<?php
/**
 * defines interfaces for Webappkit filesystem libraries
 *
 * This file is part of Webappkit, a packages system for PHP web apps
 * @link http://webappkit.net
 * @package webappkit
 * @subpackage fs
 * @author J.Ducastel <nospam0@ducastel.name>
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */

/**
 * filesystem element
 */
interface iWakFS {

    /**
     * @param string $path
     */
    public function __construct($path);

    /**
     * return given path
     * @return string
     */
    public function path();

    /**
     * @return absolute path
     * @return string
     */
    public function realPath();

    /**
     * get directory's name, whithout trailing slash
     * @return string
     */
    public function dirname();

    /**
     * get self base name
     * @return string
     */
    public function basename();

    /**
     * does element exists ?
     * @return bool
     */
    public function exists();

    /**
     * is element readable ?
     * @return bool
     */
    public function isReadable();

    /**
     * is element writable ?
     * @return bool
     */
    public function isWritable();

    /**
     * create the element if it doesn't exist
     * @return bool
     */
    public function create();

    /**
     * rename element within the same directory
     * @return bool
     * @param string $new_name
     */
    public function rename($new_name);

    /**
     * move element to new path (keeps basename)
     * @return bool
     * @param string $new_path
     */
    public function move($new_path);

    /**
     * destroy element
     * @return bool
     */
    public function delete();
}
